const http = require("http");
const fs = require("fs");

http.createServer((req,res) => {
    if(req.url == '/'){
        var fileContent = fs.readFileSync("./get.html");
        res.writeHead(200,{"Content-Type":"text/html;charset=utf8"})
        res.write(fileContent);
        res.end();
    }
    else{
        var urlObj = new URL(req.url,"http://localhost:8081/");
        var newsId = urlObj.searchParams.get("newsId");
        console.log(newsId);
    }
}).listen(8081)

console.log("listen 8081")